//
// Created by Lenovo on 2020/10/13.
//

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long

int main()
{
   ll n,m;
   ll maxn = 2016;
   cin>>n>>m;
   ll ans = 0;
   ll numa,numb;
   for(ll i = 1;i<=min(maxn,n);i++)
   {
       for(ll j = 1;j<=min(maxn,m);j++)
       {
           if((i*j)%maxn==0)
           {

                numa = (n-i%2016)/maxn;
                numb = (m-j%2016)/maxn;
                //cout<<numa<<"    "<<numb<<endl;
                if(i<maxn) numa++;
                if(j<maxn) numb++;
                ans +=  numa*numb;
           }
       }
   }
   cout<<ans<<endl;
}